package com.ruoyi.mobile.service;

import com.ruoyi.db.ums.domain.UmsUser;
import com.ruoyi.mobile.dto.UserInfo;
import com.ruoyi.mobile.project.ums.service.WxUmsUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

@Service
public class UserInfoService
{
    @Autowired
    private WxUmsUserService userService;

    public UserInfo getInfo(Long userId)
    {
        UmsUser user = userService.findById(userId);
        Assert.state(user != null, "用户不存在");
        UserInfo userInfo = new UserInfo();
        userInfo.setNickName(user.getNickname());
        userInfo.setAvatarUrl(user.getAvatar());
        return userInfo;
    }
}
